package com.smarth.zhizulian.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.smarth.zhizulian.R;
import com.smarth.zhizulian.app.BaseActivity;
import com.smarth.zhizulian.utils.CommonUtils;
import com.smarth.zhizulian.utils.KumaToast;
import com.umeng.message.entity.UMessage;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by 18865 on 2017/12/30.
 */

public class AboutUsActivity extends BaseActivity {
    @BindView(R.id.tv_version)
    TextView tvVersion;
    public static final String INTENT_MODE = "INTENT_MODE";
    public static final int MODE_SERVICE = 0;
    public static final int MODE_COMEON = 1;
    @BindView(R.id.ll_service)
    LinearLayout llService;
    @BindView(R.id.ll_comeon)
    LinearLayout llComeon;
    private int mMode;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_aboutus);
        ButterKnife.bind(this);
        mMode = getIntent().getIntExtra(INTENT_MODE, MODE_SERVICE);
        tvVersion.setText("当前版本号：" + CommonUtils.getVersionName(mContext));
        switch (mMode) {
            case MODE_SERVICE:
                setTitlebar("联系我们", true);
                llService.setVisibility(View.VISIBLE);
                break;
            case MODE_COMEON:
                setTitlebar("商务合作", true);
                llComeon.setVisibility(View.VISIBLE);
                break;
        }
    }

    @OnClick({R.id.btn_copy_qq, R.id.btn_copy_wechat, R.id.btn_comeon})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.btn_copy_qq:
                CommonUtils.copyToClipboard(mContext, "1226372200");
                break;
            case R.id.btn_copy_wechat:
                CommonUtils.copyToClipboard(mContext, "BZ1226372200");
                break;
            case R.id.btn_comeon:
                CommonUtils.copyToClipboard(mContext, "13121909914");
                break;
        }
    }

    public static void open(Context context) {
        Intent i = new Intent(context, AboutUsActivity.class);
        i.putExtra(INTENT_MODE, MODE_SERVICE);
        context.startActivity(i);
    }

    public static void openForComeOn(Context context) {
        Intent i = new Intent(context, AboutUsActivity.class);
        i.putExtra(INTENT_MODE, MODE_COMEON);
        context.startActivity(i);
    }
}
